package model

import (
	"gorm.io/gorm"
	"strconv"
)

type Videos struct {
	gorm.Model
	VideosUrl string `gorm:"type:varchar(30);commit:视频Url"`
	Episode   string `gorm:"type:varchar(225);commit:剧集"`
	Duration  string `gorm:"type:varchar(225);commit:时长"`
	VideoName string `gorm:"type:varchar(225);commit:标题"`
	Status    string `gorm:"type:varchar(12);commit:状态"`
	Type      string `gorm:"type:varchar(30);commit:分类"`
	Label     string `gorm:"type:varchar(30);commit:标签"`
	VideosNum string `gorm:"type:varchar(225);commit:标识码"`
}

func (v *Videos) VideosAdd(DB *gorm.DB) error {
	var err error
	err = DB.Create(&v).Error
	return err
}

func (v *Videos) VideoUpdate(DB *gorm.DB, Id int, status int) error {
	err := DB.Where("id= ?", Id).Update(strconv.Itoa(Id), status).Error
	return err
}

type Review struct {
	gorm.Model
	VideosId     int    `gorm:"type:int;commit:视频Id"`
	Status       string `gorm:"type:int;commit:1:待审,2:通过,3:拒绝"`
	Opinion      string `gorm:"type:varchar(225);commit:审核意见"`
	ReviewName   string `gorm:"type:varchar(225);commit:审核姓名"`
	ReviewNumber string `gorm:"type:varchar(225);commit:审核号"`
}

func (r *Review) ReviewAdd(DB *gorm.DB) error {
	var err error
	err = DB.Create(&r).Error
	return err
}
